// DNS 域名解析
package main

import (
    "os"
    "fmt"
    "net"
)

func main() {
    if len(os.Args) != 2 {
        fmt.Fprintf(os.Stderr, "Usage: %s hostname\n", os.Args[0])
        fmt.Println("Usage: ", os.Args[0], "hostname")
        os.Exit(1)
    }
    name := os.Args[1]
    addr, err := net.ResolveIPAddr("ip", name)
    if err != nil {
        fmt.Println("Resolvtion error",err.Error())
        os.Exit(1)
    }
    fmt.Println("Resolved address is ", addr.String())
    os.Exit(0)
}
